import { App } from 'vue';
import { withInstall } from '@ibiz-template/vue3-util';
import { registerAcItemProvider } from '@ibiz-template/runtime';
import { AcItemPlugin } from './ac-item';
import { AcItemPluginProvider } from './ac-item-provider';

export const IBizAcItemPlugin = withInstall(AcItemPlugin, function (v: App) {
  // 全局注册自填列表项插件组件
  v.component(AcItemPlugin.name, AcItemPlugin);
  // 全局注册自填列表项适配器，AC_ITEM是插件类型，RR9AcItemPluginId是插件标识
  registerAcItemProvider(
    'AC_ITEM_R9AcItemPluginId',
    () => new AcItemPluginProvider(),
  );
});

export default IBizAcItemPlugin;
